
{extend name='public/window' /}

{block name="content"}

<div class="layui-fluid">
    <div class="layui-card">

        <div class="layui-card-body" style="padding: 15px;">
            <form class="layui-form" action="" lay-filter="form">
            <div class="layui-tab layui-tab-brief">
                <ul class="layui-tab-title">
                    <li class="layui-this">基本内容</li>
                    
                </ul>
                <div class="layui-tab-content" style="margin-top: 20px;">

                    <div class="layui-tab-item layui-show">
                        
                        <div class="layui-form-item">
                            <label class="layui-form-label">所属栏目：</label>
                            <div class="layui-input-block">
                                <select name="cate_id" lay-verify="required" >
                                    <option value="0">请选择</option>
                                    {$cate|make_option='','title_show','id'}
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">省市区</label>
                            <div class="layui-input-inline">
                                <select name="areaid1" id="area1" lay-filter="area1">
                                    <option value="0">请选择省</option>
                                    {volist name="area1_list" id="v"}
                                    <option value="{$v.id}" {if $info.areaid1==$v.id}selected{/if}>{$v.shortname}</option>
                                    {/volist}
                                </select>
                            </div>
                            <div class="layui-input-inline">
                                <select name="areaid2" id="area2" lay-filter="area2">
                                    <option value="0">请选择市</option>
                                    {volist name="area2_list" id="v"}
                                    <option value="{$v.id}" {if $info.areaid2==$v.id}selected{/if}>{$v.shortname}</option>
                                    {/volist}
                                </select>
                            </div>
                            <div class="layui-input-inline">
                                <select name="areaid3" id="area3">
                                    <option value="0">请选择县/区</option>
                                    {volist name="area3_list" id="v"}
                                    <option value="{$v.id}" {if $info.areaid3==$v.id}selected{/if}>{$v.shortname}</option>
                                    {/volist}
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-mid layui-word-aux"></div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">UID：</label>
                            <div class="layui-input-block input-custom-width">
                                <input type="text" name="uid" value="" lay-verify="required" class="layui-input ">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">店铺名称：</label>
                            <div class="layui-input-block input-custom-width">
                                <input type="text" name="name" value="" class="layui-input ">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">坐标：</label>
                            <div class="layui-input-block input-custom-width">
                                <input type="text" name="location" value="" class="layui-input ">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">省份：</label>
                            <div class="layui-input-inline input-custom-width">
                                <input type="text" name="pname" class="layui-input ">
                            </div>

                            <label class="layui-form-label">省份代码：</label>
                            <div class="layui-input-inline input-custom-width">
                                <input type="text" name="pcode" value="" class="layui-input ">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">城市：</label>
                            <div class="layui-input-inline input-custom-width">
                                <input type="text" name="cityname" class="layui-input ">
                            </div>

                            <label class="layui-form-label">城市代码：</label>
                            <div class="layui-input-inline input-custom-width">
                                <input type="text" name="citycode" value="" class="layui-input ">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">地区：</label>
                            <div class="layui-input-inline input-custom-width">
                                <input type="text" name="adname" class="layui-input ">
                            </div>

                            <label class="layui-form-label">地区代码：</label>
                            <div class="layui-input-inline input-custom-width">
                                <input type="text" name="adcode" value="" class="layui-input ">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">地址：</label>
                            <div class="layui-input-block input-custom-width">
                                <input type="text" name="address" value="" class="layui-input ">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">商圈：</label>
                            <div class="layui-input-block input-custom-width">
                                <input type="text" name="business_area" value="" class="layui-input ">
                            </div>
                        </div>

                        <div class="layui-form-mid layui-word-aux"></div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">类型：</label>
                            <div class="layui-input-block input-custom-width">
                                <input type="text" name="type" value="" class="layui-input ">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">标签：</label>
                            <div class="layui-input-block input-custom-width">
                                <textarea name="tag" class="layui-textarea"></textarea>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">电话：</label>
                            <div class="layui-input-block input-custom-width">
                                <input type="text" name="tel" value="" class="layui-input ">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">费用：</label>
                            <div class="layui-input-inline input-custom-width">
                                <input type="text" name="cost" class="layui-input ">
                            </div>

                            <label class="layui-form-label">评分：</label>
                            <div class="layui-input-inline input-custom-width">
                                <input type="text" name="rating" value="" class="layui-input ">
                            </div>
                        </div>

                        <div class="layui-form-mid layui-word-aux"></div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">封面图：</label>
                            <div class="layui-input-block input-custom-width">
                                <input type="text" name="litpic" value="" class="layui-input ">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">介绍：</label>
                            <div class="layui-input-block input-custom-width">
                                <textarea name="jieshao" class="layui-textarea"></textarea>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">公交：</label>
                            <div class="layui-input-block input-custom-width">
                                <textarea name="gongjiao" class="layui-textarea"></textarea>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">地铁：</label>
                            <div class="layui-input-block input-custom-width">
                                <textarea name="ditie" class="layui-textarea"></textarea>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">停车场：</label>
                            <div class="layui-input-block input-custom-width">
                                <textarea name="tingche" class="layui-textarea"></textarea>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">餐厅：</label>
                            <div class="layui-input-block input-custom-width">
                                <textarea name="canting" class="layui-textarea"></textarea>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">酒店：</label>
                            <div class="layui-input-block input-custom-width">
                                <textarea name="jiudian" class="layui-textarea"></textarea>
                            </div>
                        </div>

                        <div class="layui-form-mid layui-word-aux"></div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">是否显示：</label>
                            <div class="layui-input-inline input-custom-width">
                                <input type="radio" name="is_show" value="1" title="显示" lay-filter=""  checked>
                                <input type="radio" name="is_show" value="0" title="不显示" lay-filter="" >
                            </div>

                            <label class="layui-form-label">点击量：</label>
                            <div class="layui-input-inline input-custom-width">
                                <input type="number" min="0" name="hits" value="0" placeholder="" lay-verify="required" lay-vertype="tips" lay-reqtext="" autocomplete="off" class="layui-input ">
                            </div>
                            <div class="layui-form-mid layui-word-aux"></div>
                        </div>

                        {if isset($info.id)}
                        <input type="hidden" name="id" value="{$info.id}">
                        {/if}
                    </div>

                    

                </div>

            </div>
                <div class="layui-form-item layui-layout-admin " style="width: 100%">
                    <div class="layui-input-block">
                        <div class="layui-footer" style="left: 0px;text-align: center;">
                            <button class="layui-btn" lay-submit="" lay-filter="add">{:__('Submit')}</button>
                            <button type="reset" class="layui-btn layui-btn-primary">{:__('Reset')}</button>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

<script>
    layui.use(['element', 'form', 'jquery','lucky'], function () {
        var element = layui.element;
        var table = layui.table;
        var form = layui.form;
        var $ = layui.jquery;
        var lucky=layui.lucky;

        //表单赋值
        var info = {:json_encode($info)};
        form.val("form",info);

        form.on('submit(add)', function (data) {
            lucky.FormSubmit("{:url('upAndAdd')}",data.field,true);
            return false;
        });

        form.on('select(area1)', function(data) { 
            $("#area2").empty();
            $("#area2").append('<option value="0">请选择市</option>');
            $("#area3").empty();
            $("#area3").append('<option value="0">请选择县/区</option>');
            form.render("select");
            if(data.value != 0){
                $.get("{:url('area/ajaxGetAreaSon')}",{pid:data.value},function(result){
                    if(result.code){
                        $.each(result.data,function(index,obj){
                            $("#area2").append('<option value="'+obj.id+'">'+obj.shortname+'</option>');
                        });
                        form.render("select");
                    }
                });
            }
        })
        form.on('select(area2)', function(data) { 
            $("#area3").empty();
            $("#area3").append('<option value="0">请选择县/区</option>');
            form.render("select");
            if(data.value != 0){
                $.get("{:url('area/ajaxGetAreaSon')}",{pid:data.value},function(result){
                    if(result.code){
                        $.each(result.data,function(index,obj){
                            $("#area3").append('<option value="'+obj.id+'">'+obj.shortname+'</option>');
                        });
                        form.render("select");
                    }
                });
            }
        })

    })
</script>

{/block}

